<template>
	<view class="justify-between align-center combody">
		<image v-if="type==1" @click="tohome" src="../static/images/serve/toplogo.png"
				style="width: 162rpx;height: 50rpx;"></image>
				<image v-else @click="tohome" src="../static/images/home/toplogo.png"
						style="width: 162rpx;height: 50rpx;"></image>
		<view class="bgfff searchbox justify-between align-center">
			<input class="searchinput" v-model="keywords" type="text" placeholder="搜索关键词"
				:placeholderStyle="placeholderStyle" />
			<image @click="tosearch" src="../static/images/home/searchimg.png" style="width:48rpx ;height:48rpx ;">
			</image>
		</view>
	</view>
</template>

<script>
	export default {
		props: ['type', 'keys'],
		mounted() {
			if (this.keys) {
				this.keywords = this.keys
			}
		},
		data() {
			return {
				placeholderStyle: "color:#7E8987;font-size:32rpx;font-weight: 400;",
				keywords: '',
			}
		},
		methods: {
			tohome() {
				uni.navigateTo({
					url: '/pages/home'
				})
			},
			tosearch() {
				console.log(this.keywords)
				uni.navigateTo({
					url: '/pages/knowledge/druglist?keywords=' + this.keywords
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.combody {

		.searchbox {
			width: 516rpx;
			height: 60rpx;
			background: #FFFFFF;
			border-radius: 60rpx;
			border: 2rpx solid rgba(0, 217, 178, 0.2);
			padding: 0 24rpx;

			.searchinput {
				font-size: 28rpx
			}

		}
	}
</style>